import request from '@/utils/request';

// 我的工单
export function getProcessInstanceList(data) {
  return request({
    url: '/workflow/processInstance/getPageByCurrent',
    method: 'get',
    data,
    isJson: true,
  });
}

// 我的工单-删除
export function deleteRunAndHisInstance(data) {
  return request({
    url: `/workflow/processInstance/deleteRunAndHisInstance/${data}`,
    method: 'delete',
    isJson: true,
  });
}

// 我的工单-撤销
export function cancelProcessApply(data) {
  return request({
    url: `/workflow/processInstance/cancelProcessApply/${data}`,
    method: 'post',
    isJson: true,
  });
}

// 待办
export function getTaskWaitList(data) {
  return request({
    url: '/workflow/task/getPageByTaskWait',
    method: 'get',
    data,
    isJson: true,
  });
}

// 已办
export function getTaskFinishList(data) {
  return request({
    url: '/workflow/task/getPageByTaskFinish',
    method: 'get',
    data,
    isJson: true,
  });
}

// 抄送
export function getTaskCopyList(data) {
  return request({
    url: '/workflow/task/getPageByTaskCopy',
    method: 'get',
    data,
    isJson: true,
  });
}

// 访客邀约详情
export function getVisitorInviteDetail(data) {
  return request({
    url: '/workflow/visitorInvite/' + data,
    method: 'get',
    isJson: true,
  });
}

// 获取任务数据
export function getTaskById(data) {
  return request({
    url: '/workflow/task/getTaskById/' + data,
    method: 'get',
    isJson: true,
  });
}

// 获取节点数据
export function getTaskNodeList(data) {
  return request({
    url: '/workflow/task/getTaskNodeList/' + data,
    method: 'get',
    isJson: true,
  });
}

// 获取顶级节点下拉数据 - 搜索
export function getCategoryList(data) {
  return request({
    url: '/workflow/category/list',
    method: 'get',
    data,
    isJson: false,
  });
}

// 安防事件详情
export function getSecurityDetail(data) {
  return request({
    url: '/workflow/security/' + data,
    method: 'get',
    isJson: true,
  });
}

// 设备维修详情
export function getFacilityRepairDetail(data) {
  return request({
    url: '/workflow/facilityRepair/' + data,
    method: 'get',
    isJson: true,
  });
}

// 维修服务详情
export function getRepairServiceDetail(data) {
  return request({
    url: '/workflow/repairService/' + data,
    method: 'get',
    isJson: true,
  });
}

// 职工入住公寓详情
export function getEmployeeApartmentDetail(data) {
  return request({
    url: '/workflow/employeeApartment/' + data,
    method: 'get',
    isJson: true,
  });
}

// 外来人员入住公寓详情
export function getExterPersonApartmentDetail(data) {
  return request({
    url: '/workflow/exterPersonApartment/' + data,
    method: 'get',
    isJson: true,
  });
}

// 出门证详情
export function getPassPermitDetail(data) {
  return request({
    url: '/workflow/passPermit/' + data,
    method: 'get',
    isJson: true,
  });
}

// 请假流程详情
export function getLeaveDetail(data) {
  return request({
    url: '/workflow/leave/' + data,
    method: 'get',
    isJson: true,
  });
}

// 报事报修详情
export function getBaoshiBaoxiuDetail(data) {
  return request({
    url: '/workflow/baoshiBaoxiu/' + data,
    method: 'get',
    isJson: true,
  });
}

// 工单提交
export const completeTask = (data) => {
  return request({
    url: '/workflow/task/completeTask',
    method: 'post',
    data: data,
    isJson: true,
  });
};

// 转办
export const transferTask = (data) => {
  return request({
    url: '/workflow/task/transferTask',
    method: 'post',
    data: data,
    isJson: true,
  });
};

// 委托
export const delegateTask = (data) => {
  return request({
    url: '/workflow/task/delegateTask',
    method: 'post',
    data: data,
    isJson: true,
  });
};

// 驳回
export const backProcess = (data) => {
  return request({
    url: '/workflow/task/backProcess',
    method: 'post',
    data: data,
    isJson: true,
  });
};

// 终止
export const terminationTask = (data) => {
  return request({
    url: '/workflow/task/terminationTask',
    method: 'post',
    data: data,
    isJson: true,
  });
};

// 加签
export const addMultiInstance = (data) => {
  return request({
    url: '/workflow/task/addMultiInstanceExecution',
    method: 'post',
    data: data,
    isJson: true,
  });
};

// 减签
export const delMultiInstance = (data) => {
  return request({
    url: '/workflow/task/deleteMultiInstanceExecution',
    method: 'post',
    data: data,
    isJson: true,
  });
};

// 工作流加签人员数据
export function getTaskUserIdsByAddMultiInstance(data) {
  return request({
    url: `/workflow/task/getTaskUserIdsByAddMultiInstance/${data}`,
    method: 'get',
    isJson: true,
  });
}

// 工作流减签人员数据
export function getListByDeleteMultiInstance(data) {
  return request({
    url: `/workflow/task/getListByDeleteMultiInstance/${data}`,
    method: 'get',
    isJson: true,
  });
}
